package book;

/**
 * Creared with IntelliJ IDEA.
 * Description:
 * User:yxd
 * Date:2022-01-05
 * Time:2:06
 */
//Description:图书顺序表
public class BookList {//存放图书的顺序表
    private  Book[] books = new Book[10];//图书数组
    private  int UsedSize;//图书有效个数
    public BookList(){//构造方法  先默认三本书
        books[0] = new Book("三国演义","罗贯中",50,"小说");
        books[1] = new Book("水浒传","施耐庵",50,"小说");
        books[2] = new Book("西游记","吴承恩",50,"小说");
        this.UsedSize = 3;
    }

    public int getUsedSize() {
        return UsedSize;
    }//得到当前有效元素个数

    public void setUsedSize(int usedSize) {
        UsedSize = usedSize;
    }//修改当前元素个数
    //获取pos位置上的书
    public Book getBook(int pos) {
        return this.books[pos];
    }
    //设置pos下标为一本书  添加一本书 也就是get set方法
    public void setBooks(int pos,Book book) {
        this.books[pos] = book;
    }


}

